package com.kuang.demo.controller.wx;

import com.kuang.demo.bean.BaseRespVo;
import com.kuang.demo.bean.wx.CollectAddordeleteBean;
import com.kuang.demo.bean.wx.CollectAddordeleteVo;
import com.kuang.demo.bean.wx.CollectListVo;
import com.kuang.demo.service.wx.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ACG
 * @date 2020-11-05 20:41
 */


@RestController
@RequestMapping("wx/collect")

public class CollectController {

    @Autowired
    CollectService collectService;
    //wx/collect/addordelete
    @RequestMapping("/addordelete")
    public BaseRespVo addordeleteControl(@RequestBody CollectAddordeleteBean collectAddordeleteBean){
     String  state =  collectService.addordeleteControl(collectAddordeleteBean);
        CollectAddordeleteVo collectAddordeleteVo = new CollectAddordeleteVo();
        collectAddordeleteVo.setType(state);
        return BaseRespVo.ok(collectAddordeleteVo);
    }

    //http://182.92.235.201:8083/wx/collect/list?type=0&page=1&size=10
    @RequestMapping("/list")
    public BaseRespVo listControl(Integer type,Integer page,Integer size){
       CollectListVo collectListVo= collectService.listControl(type,page,size);
       return BaseRespVo.ok(collectListVo);
    }
}
